Bluetooth serial adapters

ABSTRACT

A Bluetooth serial adapter comprising a Bluetooth connection module ( 21 ) for conducting Bluetooth communication with another Bluetooth enabled device, a serial connector SP allowing connection of a serial cable between the adapter and a device having a serial port, and a serial to Bluetooth interface ( 23 ) arranged for: receiving serial connection control commands input via the serial connector; mapping received serial connection control commands to Bluetooth connection control events; and outputting the so determined Bluetooth connection control events to the Bluetooth connection module. The interface ( 23 ) may be implemented by making use of a virtual machine provided on the Bluetooth chip.

This application relates to Bluetooth serial adapters.

Bluetooth is a recently developed but well known short range radiofrequency communication standard, system and protocol. It is used inmany different circumstances including, for example, communicationbetween PCs, from PCs to hand held computers, from mobile telephones toPCs, and from mobile telephone handsets to ear pieces.

The Bluetooth system or standard as a whole allows a wide range ofdifferent communication regimes. It is therefore very flexible and isset up in a very generic way to allow use in all of these differentways. This however has the side effect that implementing a specificcommunication system using Bluetooth is complex and uses large amountsof computing resources.

To put this another way, when a fully functional Bluetooth system isused there is a huge processing overhead. Such systems are feasible whenimplemented using a relatively powerful computer such as a PC runningthe Windows operating system (for which suitable software tools forcontrolling Bluetooth connections exist). The systems are not, however,a practical proposition where processing power is limited. Typical caseswhere processing power is limited are devices which rely on embeddedprocessors. There is a wide range of devices which rely on embeddedprocessors including household, commercial and industrial machines andappliances.

One particular situation where there is an embedded processor andlimited processing capability is in the case of mobile telephones andtheir ear pieces. As mentioned above this is one area where Bluetoothcommunication is used. Here (and in other similar situations) a subsetof Bluetooth is used which only implements specific functions asrequired. In this case on first activation the two Bluetooth devices(handset and ear piece) must be “bonded” to one another. Once this isdone, a connection is made between the two devices and communication canproceed.

Bonding is a simple operation for the user, normally just requiring thepressing of a button (switch) as the devices are activated. EachBluetooth device has a unique address and during the bonding processthese are exchanged in addition to a pin number. After bonding the twodevices will “talk” to each other but no other Bluetooth device. If itis desired to allow communication between one of the two devices and athird device, the existing bond must be broken and the new one made byappropriate human, usually manual, intervention.

This necessity makes such systems unworkable where it is desired tohave, for example, a central unit which can communicate with a pluralityof peripheral units via one Bluetooth connection device at the centralunit. Manual intervention would be needed each time it was desired tostop communicating with one peripheral unit in favour of another.

FIG. 1 is a diagram showing the layers of a “dumb” serial cablereplacement Bluetooth device that might be used in a simplifiedBluetooth communication system of the type described above.

Based on the state of the ‘Switch’, the layer labelled “Serial CableReplacement Virtual Machine App” is in one of two modes. In one mode, itallows other Bluetooth devices to be detected and if a ‘twin’ isdetected, then it bonds to that device. In the other mode, if it hasdetails of a previously bonded remote device, then it will attempt tomake a Bluetooth connection with it. It will retry continually until aconnection is established.

Once connection is established all ‘Application’ data at the serial portis transparently presented at the RF interface using a serial portprofile routed via the RFCOMM layer. When a connection does not exist,the data from the application is dumped.

An alternative way to enable Bluetooth communication from a devicehaving an embedded processor is to provide a system where the processingis carried out on the embedded processor or an associated processor inthe device and a separate generic Bluetooth connection device is used.This is analogous to systems where the necessary processing andimplementation is carried out by a Windows PC. However, a large amountof programming and/or hardware/firmware changes are required if thisroute is followed, which has a significant impact on time to market.

In this scenario, the upper layers of the Bluetooth stack reside in thedevice having the embedded processor (host device). This system willrequire Bluetooth qualification. In addition, the task of porting theupper layers of the stack onto the host device is not trivial. Morefunctionality can be achieved but the work required as compared to theabove solution is many orders of magnitude larger. In addition higherprocessing demands will be made of the embedded processor. FIG. 2 showsthe layers in the host device and the Bluetooth device in such a system.

It is an object of this invention to provide a methods, systems andapparatus for easing Bluetooth communication with devices having limitedprocessing capabilities.

According to one aspect of the present invention there is provided aBluetooth serial adapter comprising a Bluetooth connection module forconducting Bluetooth communication with another Bluetooth enableddevice, a serial connector allowing connection of a serial cable betweenthe adapter and a device having a serial port, and a serial to Bluetoothinterface arranged for: receiving serial connection control commandsinput via the serial connector, mapping received serial connectioncontrol commands to Bluetooth connection control events; and outputtingthe so determined Bluetooth connection control events to the Bluetoothconnection module.

According to another aspect of the present invention there is provided aBluetooth serial adapter comprising a Bluetooth connection module forconducting Bluetooth communication with another Bluetooth enableddevice, a serial connector allowing connection of a serial cable betweenthe adapter and a device having a serial port, and a serial to Bluetoothinterface arranged for: receiving Bluetooth connection control eventsfrom the Bluetooth connection module; mapping received Bluetoothconnection control events to serial connection control commands; andoutputting the so determined serial connection control commands to theserial connector for onward transmission to a device having a serialport.

According to another aspect of the present invention there is provided amethod of communicating via a Bluetooth connection using a device with aserial port, comprising the step of using a Bluetooth serial adaptercomprising a Bluetooth connection module for conducting Bluetoothcommunication with another Bluetooth enabled device, a serial connectorconnected via a serial cable to the device having a serial port, and aserial to Bluetooth interface, the method further comprising the serialto Bluetooth interface carrying out the steps of: receiving serialconnection control commands from the device via the serial cable;mapping received serial connection control commands to Bluetoothconnection control events; and outputting the so determined Bluetoothconnection control events to the Bluetooth connection module.

According to another aspect of the present invention there is provided amethod of communicating via a Bluetooth connection using a device with aserial port, comprising the step of using a Bluetooth serial adaptercomprising a Bluetooth connection module for conducting Bluetoothcommunication with another

Bluetooth enabled device, a serial connector connected via a serialcable to the device having a serial port, and a serial to Bluetoothinterface, the method further comprising the serial to Bluetoothinterface carrying out the steps of: receiving Bluetooth connectioncontrol events from the Bluetooth connection module; mapping receivedBluetooth connection control events to serial connection controlcommands; and outputting the so determined serial connection controlcommands via the serial cable to the device having a serial port.

It will be appreciated that the interface can work in both directionswithin a given device. That is to say Bluetooth and serial connectioncontrol events/commands can be sent and received in both directions andmapping can be carried out in both directions during the operation ofthe adapter, from either the serial port or the RF interface.

According to another aspect of the present invention there is provided avirtual serial connection system between two devices each of which has aserial port, the system comprising a pair of Bluetooth serial adaptersas defined above, one of the adapters being connected to a first of thedevices via a first serial cable and the other of the adapters beingconnected to the second of the devices via a second serial cable,wherein the virtual serial connection is completed by Bluetoothcommunication between the two Bluetooth serial adapters.

It should be noted that in other aspects of the invention a Bluetoothserial adapter as defined above may be used in communication withanother type Bluetooth enabled device. This is on the basis that theother Bluetooth enabled device is operated in a way which is compatiblewith the Bluetooth serial adapter.

The set of serial connection control commands can be chosen to suit aspecific implementation. Typically the set of commands will be limitedcompared with the vast array of events and capabilities provided inBluetooth. Thus whilst each serial connection control command is mappedto a corresponding Bluetooth event, in a typical implementation therewill be a vast number of Bluetooth events that have no correspondingserial connection control command. Clearly such events cannot be usedwithin the corresponding system or method. However the point is that infacilitating a virtual serial connection, which is the main objectivehere, the vast majority of the Bluetooth capabilities are irrelevant.

The reduced and simplified command set dramatically simplifies theprocess of reconfiguring a device having a serial port so as to be ableto function with a serial adapter of the present application and therebyfacilitate the use of a Bluetooth connection. On one hand theprogramming or alterations in hardware/firmware needed in the device toallow it to issue and receive appropriate commands is minimised and onthe other hand the amount of processing which the device has to carryout is also reduced.

In effect this processing and reconfiguration burden is taken on in thedevelopment and operation of the adapter. As such a major part of thereconfiguration effort has to be carried out only once—in thedevelopment of the adapter which can be easily used with other devices.Further in each case the overall processing required has been cut downby the development of an adapter designed to perform a specific task andsome of this processing is carried out by the adapter itself to furtherreduce that required in the device having the serial port.

The present application is concerned with the protocols/commands used incontrolling a connection between two devices using a Bluetoothconnection. Once a connection is established the serial adapter hasperformed its function. The protocols etc used for transmitting dataitself are a separate issue with which this application is notconcerned.

In preferred embodiments of the invention the serial connection controlcommands comprise a command set having commands which are analogous toor more preferably still are directly related to or substantiallyidentical to commands used in an industry standard command set used incontrolling Modem connections. This can allow the serial adapter toaccept commands from and issue commands to Modems or devices configuredto exchange such commands with Modems.

There are likely to be cases where there is a need for commands to becommunicated between the adapter and devices which are not by defaultready to accept industry standard Modem commands. In the case of suchdevices reconfiguration/programming will be required but this would betrue whatever the command set used so this is no disadvantage. Moreoverfamiliarity with the Modem commands is likely to ease thereconfiguration/programming process.

A command set known as the AT command set, originally developed byHayes, is currently the most widely used command set for controllingModem connections. Preferably the serial connection control commandscomprise a set of AT commands. These would be familiar todevelopers/programmers and would be recognised by AT compatible Modemsand other devices. It is unlikely to be necessary to use the complete ATcommand set or protocol in a system of the present kind.

The serial connection control commands may comprise the set of commandsor a subset of the commands mentioned and explained in section 3.2 ofAnnex 1 to the description of this application. The serial connectioncontrol commands may comprise a modified set of commands based on theset of commands or a subset of the commands mentioned and explained insection 3.2 of Annex 1 to the description of this application. Themodifications may comprise replacing the generic root “AT” (or part ofthis root) with another root for example “BT” or “TDK”.

Typically, the Bluetooth connection module comprises a Bluetooth chip.At least some standard Bluetooth chips carry a programmable virtualmachine which may be used to perform secondary functions. In one set ofpreferred embodiments the serial to Bluetooth interface is implementedby appropriately programming the virtual machine provided on a theBluetooth chip.

This leads to a particularly efficient solution. The functionalityprovided by the virtual machine is particularly suited to performing themapping operation. Further, in many current implementations little or nouse is made of the processing power available via the virtual machine.

According to another aspect of this invention there is provided acomputer program comprising code portion which when loaded and run oncomputer means cause the computer means to carry out any one of themethods defined above. The program may be carried on a computer readabledata carrier such as a signal or a record medium for example RAM, ROM,EEPROM, a floppy disk, a hard disk, or a CD-ROM.

Embodiments of the present invention will now be described, by way ofexample only, with reference to the accompanying drawings in which:

FIG. 1 shows the layers in a prior art “dumb” serial cable replacementBluetooth communication device;

FIG. 2 shows the layers in a host device and Bluetooth device in analternative Bluetooth communication system, where part of the Bluetoothstack resides on the host device;

FIG. 3 is a simplified schematic representation of a communicationsystem including Bluetooth serial adapters embodying the presentinvention;

FIG. 4 shows the layers in a Bluetooth AT Serial Module acting as aBluetooth serial adapter embodying the present invention; and

FIG. 5 schematically shows an application for Bluetooth AT SerialModules embodying the present invention.

FIG. 3 schematically shows a communication system where two host devices1 having embedded microprocessors (not shown) and serial ports SP, areconnected to one another to allow the transmission of data therebetween.

If it were not desired to use a wireless connection, the two devicescould be connected directly to one another via a serial cable. However,wireless connections carry with them advantages such as eliminating theneed to route or re-route cabling.

The present application is concerned with allowing the replacement ofserial cable connections with wireless connections and particularlyBluetooth connections. The ideas of the present application areparticularly useful where the devices to be connected have embeddedprocessors. Such devices tend to have limited processing capabilities.Further there is generally a desire to minimise the reconfigurationand/or reprogramming of such embedded processors.

In the system shown in FIG. 3, each device is connected via a respectiveserial cable C to a serial port SP of a respective Bluetooth serialadapter 2. The Bluetooth serial adapters 2 are Bluetooth enabled devicesand data can be transmitted between the adapters 2 via Bluetooth radiofrequency signals 3.

The functioning of the connection system will be discussed below but atthis point it should be noted that as far as the host devices 1 areconcerned, once a connection exists via the adapters 2 this isindistinguishable from a direct serial cable connection. The connectionsystem shown in FIG. 3 thus emulates a direct serial cable connectionand can be considered as a virtual serial cable connection.

Each Bluetooth serial adapter 2 comprises a Bluetooth connection module21 including an antenna 22 which is arranged for transmitting andreceiving Bluetooth radio frequency signals. Connected between theserial port SP and the Bluetooth connection module 21 is a serial toBluetooth interface 23.

It should be appreciated that whilst the connection module 21 andinterface 23 are shown as separate components in FIG. 3 this is merelyto aid understanding. In some implementations the connection module 21and interface 23 may be implemented by separate items of softwarecontrolled hardware. In other implementation this functional separationbetween the connection module 21 and interface 23 may not be reflectedby any clear physical separation of hardware and/or software components.

At least some standard Bluetooth chips are provided with a programmablevirtual machine for carrying out secondary functions. In a preferredimplementation, used in the applicant's Bluetooth AT Serial Module, aBluetooth chip (not shown) having such a virtual machine is chosen todrive the connection 21. The functions of the interface 23 are thencarried out by appropriately programming the virtual machine provided onthe Bluetooth chip.

As part of the system there is defined a command set arranged to alloweach device 1 to enable and control connection via its respectiveadapter 2. These commands may be referred to as serial connectioncontrol commands. The command set in this embodiment comprises aselection of commands which are based on the industry standard Hayes ATcommand set used in controlling Modem connections.

Each host device 1 is either a Modem (or other device) pre-configured touse the appropriate command set or is a device that must bere-configured/programmed to use the appropriate command set. Once eitherof the above two possibilities is satisfied the host device 1 can enableand further control the connection by issuing the appropriate commands.

The serial to Bluetooth interface 23 operates to receive the commandsfrom the host device 1 via the serial port SP and based on these issuesappropriate controlling instructions to the Bluetooth connection module21, these instructions may be referred to as Bluetooth connectioncontrol events. In effect the serial to Bluetooth interface 23 mapsserial connection control commands to Bluetooth connection controlevents.

In the preferred implementation, where the programmed Bluetooth virtualmachine is used, serial connection control commands are received andprocessed by the programmed virtual machine and appropriate controllingsignals are output by the machine to control the Bluetooth chip proper.

The above processes all work in reverse. That is to say Bluetoothconnection control events received by the interface 23 from theBluetooth connection module are processed and in effect converted to ormapped to corresponding serial connection control commands which can beoutput to the respective device 1.

These processes occur in both adapters 2 to enable and control theconnection between the two host devices 1.

More details of the command set used in one embodiment, the applicant'sBluetooth AT Serial Module, and examples of when and how these commandsare used are given in the attached annex 1 to the description entitled“Technical Proposal—Intelligent Bluetooth Serial Adapter”.

It will be appreciated that the command set used may be modifiedslightly in various ways. If modifications are made it is preferred thatthe general structure of the commands is kept the same so thatfamiliarity with the AT protocol aids programming. Therefore the genericroot “AT” of the commands might be changed to say “BT” or “TDK”.

A disadvantage of moving away from the AT based command set is that thecommand set will then not be usable by existing AT compatible deviceswithout some modification. However this is not an insurmountableproblem.

FIG. 4 illustrates the layers in a Bluetooth AT Serial Module which actsas a Bluetooth serial adapter 2 of the same general type shown in FIG. 3and in which the interface is implemented by appropriately programmingthe Bluetooth chip virtual machine. It will be noted that the programprovided on the virtual machine adds a layer “AT Protocol VirtualMachine App” to the communication system. This can be seen as replacinga corresponding virtual machine layer in the “dumb” serial cablereplacement Bluetooth device as shown in FIG. 1.

On power up, the “AT Protocol” layer initialises into an idle state. Inthis state there is no Bluetooth connection, and it is continuallymonitoring the ‘Application Data’. If the data arriving from theapplication is a valid ‘AT’ command then it is actioned. There are ‘AT’commands which allow actions such as; perform a Bluetooth Inquiry; SetLocal Friendly Name; create Bluetooth Connections; destroy existingconnections etc.

When the ‘AT Protocol’ layer is in the connected state, all applicationdata is routed via RFCOMM to the RF layer for onward transmission to theremote device via the Bluetooth connection.

The system illustrated in FIG. 1 has been described as a “dumb” serialcable replacement Bluetooth device, in contrast to this, the Bluetoothserial adapters of the present application, for example the Bluetooth ATSerial Module, provide an “intelligent” serial cable replacement. When aserial cable is replaced by the present system there is no need for apair Bluetooth devices to bond to one another. Through the use of thecommand set it is possible to establish and terminate connections as andwhen required.

Moreover the present system simplifies the controls and processingneeded in the host devices such that embedded processors can readilydeal with the necessary processing and the reconfiguration/reprogrammingneeded in host devices is kept to manageable levels.

These factors make the use of Bluetooth connections feasible in a wholenew set of circumstances. It becomes possible to have a central devicewith one Bluetooth connection device (for example a Bluetooth AT SerialModule) which can communicate periodically with a plurality of otherdevices having Bluetooth AT Serial Modules. Communication between thecentral device and the other devices can be time multiplexed.

This of course can be achieved without human intervention andparticularly without manual intervention at the site of each of theother devices. Moreover this is realised using self contained units—forexample Bluetooth AT Serial Modules—rather than using separate,external, and expensive, processing power and systems that are requiredin techniques relying on the use of PCs running Windows. The selfcontained units (stand-alone modules) also include the necessaryantenna.

FIG. 5 schematically shows a system in which Bluetooth AT Serial Modulesof the type described above with reference to FIG. 4 can be used togather information from a plurality of devices via Bluetoothconnections.

In the system of FIG. 5 there is a central unit 100 comprising a Modem101 connected via a serial cable to a Bluetooth AT Serial Module 102.The central unit is provided in a games arcade where there are aplurality of games machine 104. Only three games machines are shown inFIG. 5, but in practice there might be a far larger number. Each gamesmachine 104 is connected via serial cable to a respective Bluetooth ATSerial Module 102.

Information concerning the operation of each games machine 104 isrecorded at the respective games machine 104. This information might forexample include the amount of money in the machine's cash box. We assumethat there is a desire to log and/or review the information at acomputer HQ at a central location which is accessible via the modem 101.

During an initiation stage the Bluetooth AT Serial Module 102 at eachgames machine 104 is set into an autolisten state by the respectivegames machine 104 issuing appropriate AT commands. The Bluetooth ATSerial Modules 102 remain in this state and therefore are always readyto receive and send data over the Bluetooth connection 3 to the centralunit 100.

In gathering the desired information, the computer HQ at the centrallocation can make a connection to each games machine 104 in turn. When aconnection is initiated by the computer HQ, first a connection must beestablished between the computer, its Modem, and the Modem 101 of thecentral unit 100. Then the Modem 101 of the central unit 100 issues ATcommands to the central unit's Bluetooth AT Serial Module 102. Thesecommands include the identity of the games machine 104 to whichconnection should be made—games machine 1 in the first instance.Appropriate Bluetooth signals are then transmitted from the central unit100 and detected by the Bluetooth AT Serial Module 102 of each gamesmachine 104. However, due to the identity of games machine 1 beingincluded in the signals, appropriate AT commands will only be exchangedbetween games machine 1 and its Bluetooth AT Serial Module 102 sosetting up the connection between the central computer HQ and gamesmachine 1. Once the connection is in place data can be transferred fromgames machine 1 to the central computer HQ. It should be noted that theBluetooth data connections can be optionally configured to be encryptedto prevent unauthorised “snooping” on the data.

Once this transmission is complete connection to games machine 2 can beinitiated and so on.

In alternatives a more complex interleaved time multiplexing system maybe used where it is inappropriate to allow whole sets of data to betransmitted in one block. Time slots may be allocated to each deviceonce per successive predetermined periods. In general terms there islittle limit to how the capabilities provided by the present system maybe used.

Other situations where systems of the present application may be usedinclude: connections between an electronic point of sale device and anumber of confectionery/drinks dispensers; connections between a remotedata logger and a Bluetooth enabled mobile telephone and onwards to acentral computer, and connections between a central computer and aplurality of pieces of test equipment.

Annex 1 Technical Proposal Intelligent Bluetooth Serial Adapter

1. Introduction

TDK's BC02 based Bluetooth USB Adapter provides access to the followingsignals via an optional 40 way connector: Pin No Signal Description 1AIO_0 Spare Analog I/O 2 PIO_0 Spare I/O 3 AIO_1 Spare Analog I/O 4PIO_1 Spare I/O 5 SPI_MOSI SPI bus serial in I/P 6 PIO_2 Spare I/O 7SPI_CSB SPI bus chip select I/P 8 PIO_3 Spare I/O 9 SPI_CLK SPI busclock I/P 10 PIO_4 Spare I/O 11 GND 12 PIO_5 Spare I/O 13 RESET ResetI/P 14 PIO_6 Spare I/O - o/b LED 15 GND 16 PIO_7 Spare I/O - o/b LED 17SPI_MISO SPI bus serial out O/P 18 GND 19 UART_CTS Clear to Send I/P 20PCM_CLK PCM Clock I/P 21 UART_TX Transmit Data O/P 22 PCM_IN PCM DataI/P 23 UART_RTS Request to Send O/P 24 PCM_SYNC PCM Sync I/P 25 UART_RXReceive Data I/P 26 PCM_OUT PCM Data O/P 27 VCC_3V3 3.3 V Output 28 N/C29 USB_5V VIN > 3.6 V 30 GND 31 N/C 32 USB_D− USB D− line 33 N/C 34USB_D+ USB D+ line 35 GND 36 GND 37 N/C 38 GND 39 VCC_1V8 1.8 V Output40 N/C

This means it is now possible, with appropriate firmware changes, toconstruct a cable which gives access to the Bluetooth module via a UARTinterface. The cable can be passive for embedded applications where thehost is exposing a ‘TTL’ level interface, OR it can be active wherethere is RS232 level conversion.

Hardware capability is not the entire story. How to ‘talk’ to the deviceneeds to be addressed as well. We have three options: (1) UART H4 HCIProtocol, (2) UART BCSP HCI Protocol, (3) Raw. The first two require aBluetooth stack on the host, while the third expects the bluetooth stackto be embedded in the device firmware and any data presented to it atthe UART is conveyed via RF over a serial port profile.

Offering our device in the forms of options (1) and (2), imply that ourcustomers need to make considerable investments in developing and/orpurchasing an embedded Bluetooth stack for their particular applicationand platform. This is currently a big barrier preventing a morewidespread takeup of Bluetooth wireless solutions in this market sector.

Option (3) offers the easiest, quickest and most cost effective way ofBluetooth gaining a foothold in the embedded and vertical integrationmarket segment.

This document describes the technical ‘proof of concept’ for anintelligent Bluetooth adapter as opposed to the more conventional ‘cablereplacement’ Bluetooth adapter.

2. Conventional Cable Replacement Serial Adapter

CSR provide a reference design for cable replacement Bluetooth modulebased on their BC01 and BC02 chipsets.

How does it work?

From a user's perpective, a situation exists where there are twointelligent devices communicating with each other over a serial cable.The user takes two ‘cable replacement serial adapters’ which will havethe same type of connector as the cable and plugs them into theappropriate connectors at both ends of the serial link.

There is then a ‘one-off’ procedure where these two device are made tobond and from then on, the communicating device are non the wiser thatthe link has now become virtualised.

If one of these devices is then to be used with another device, manualintervention is required to ‘unbond’ the two devices so that they can bereused elsewhere. This manual intervention will probably be asignificant factor in putting a ‘brake’ in the takeup of such a devicein the embedded market.

This implies that a non-manual reconfigurable ‘cable replacement’ serialadapter is desirable. For it to be more interesting to the embeddedmarket, the reconfigure protocol must be as simple as possible andpreferably uses or borrows concepts from existing protocols.

The next section describes such a device adapted from our existing USBBluetooth adapter.

3. Intelligent Bluetooth Serial Adapter

The idea for such a device arose from the fact that Bluetoothcommunication is connection oriented in a fashion very similar totelephony modems. In both cases there is a concept of ‘online’ and‘offline’ modes, in the latter there is also a concept of ‘command’mode.

Extending this comparison leads to the logical conclusion that a subsetof the AT Command Protocol is a very good candidate to port to a serialBluetooth adapter.

This implies, that like telephony modems, the serial adapter shouldpower up into a ‘RF’ deaf and dumb mode and will only respond via theserial interface. Then just like controlling a normal modem, the hostcan issue commands which map to various Bluetooth activities we are allaccustomed with, for example, inquiry, wait for connection, connect,pairing, encryption etc.

This device has a serial interface and an RF communications end point.The latter has a concept of connected and unconnected modes and theformer will have a concept of Command and Online mode. This leads to a2×2 matrix of four states, as shown below. RF Unconnected RF ConnectedCommand OK OK Mode Online Mode ILLEGAL OK

One combination, ‘RF unconnected’ and ‘Online Mode’ does not make senseand will be ignored.

Navigating between these states is done using a subset of AT commandsand are described in detail in the next section.

3.1 Digital & Analogue I/O

The module gives access to 8 digital i/o lines and 2 analogue lines. Thelatter can be configured as ADC's or DAC's.

Access to these lines will be provided via the ATS command. Writes tothese will be in the form ATSnnn=mmm and reads will be in the formATSnnn?.

Refer to section 3.2.7 for more details. As a rule S Registers in therange 600 to 699 are dedicated for accessing these i/o lines.

For example, to read analogue line 1, the command ATS601? will result inthe most recent sampled value to be returned. Likewise, if line 2 wasconfigured as an output, ATS602=100 will generate a new anlolgue value.All digital lines configured as outputs will be set by ATS6xx=1 andreset using ATS6xx=0.

3.2 AT Command Set

3.2.1 Assumptions

The BC02 in the TDK adapter is memory resource limited. It is also NOTproposed that there be full implementation of the AT protocol as seen inmodems. The claim made for this device is that it will have a protocolsimilar to an AT modem.

Therefore the following assumptions are made:

-   -   All commands will be terminated by the carriage return character        0x0D, which is represented by the string <cr>in descriptions        below and cannot be changed.    -   All responses from the adapter will have linefeed and carriage        return characters prepending and appending the response. These        dual character sequence has the values 0x0A and 0x0D        respectively and shall be represented by the string <lf,cr>and        cannot be changed.    -   All Bluetooth addresses shall be represented by a fixed 12 digit        hexadecimal string.    -   All Bluetooth Device Class codes shall be represented by a fixed        6 digit hexadecimal string.    -   All new Bluetooth specific commands shall be identified by the        string +BTx, where x is a mnemonic of the intended        functionality.    -   The device will ALWAYS be in non-echo mode.    -   All AT Commands shall be in uppercase and no leading or trailing        whitespaces are allowed        3.2.2 AT

Response: <lf,cr>OK<lf,cr>

3.2.3 ATZ {Reset}

Resets the device into a known state, which is Command mode andBluetooth Unconnected. All S Register settings are also set to default.

Response: <lf,cr>OK<lf,cr>

3.2.4 ATR {Hardware Reset}

Forces the device through a hardware reset. This allows changes to thePS store to take effect. For example, a baudrate change viaATS520=command. Allow for about 2 seconds for the device to startresponding to AT commands again.

Response: <lf,cr>OK<lf,cr> and then a reset will occur

3.2.5 AT&F {Set Factory Defaults}

Install default values in all S registers. Set friendly name to “TDKnnn” where nnn is the Bluetooth address. Set Device class code toFFFFFF.

Response: <lf,cr>OK<lf,cr>

3.2.6 ATIn {Information}

This will return information about the module. For example, versionnumbers, manufacturer etc

For n=0, the CSR chipset is returned

Response: <lf,cr>BC2<lf,cr>OK<lf,cr>

For n=1, the CSR firmware build number is returned, for example

Response: <lf,cr>310<lf,cr>OK<lf,cr>

For n=2, the TDK Image number is returned, for example

Response: <lf,cr>06G<lf,cr>OK<lf,cr>

For n=3, the version number of the vm app is returned, for example

Response: <lf,cr>1.01<lf,cr>OK<lf,cr>

For n=4, the colon delimited Bluetooth address of the device is returned

Response: <If,cr>aabbccddee<lf,cr>OK<lf,cr>

For n=5, the Manufacturer of this device is returned

Response: <lf,cr>TDK Systems Europe Ltd, UK<lf,cr>OK<lf,cr>

3.2.7 ATSn=nnnn {Set S Register}

There is a concept of registers which are used to store parameters, suchas escape sequence character, inquiry delay time etc, as listed indetail below. Register Default Range Comment 0 0  0 . . . 10 Number ofRING indication before auto answering an inbound connection. If value isset to 0, then set for manual answer. 2 ‘{circumflex over ( )}’  0 . . .255 Escape sequence character. It is not ‘+’ by default as a Bluetoothserial link can be used to connect to a mobile phone which exposes an ATcommand set, which will in turn use ‘+’ as default. So if both used ‘+’there would be confusion 12 100  50 . . . 5000 Escape sequence guardtime in milliseconds. 500 0 0 . . . 1 Disable Authentication, Set to 1to Enable Authentication 501 0 0 . . . 1 Disable Encryption, Set to 1 toEnable Encryption 502 10  2 . . . 61 Inquiry Length in units of seconds.This parameter is referenced by the AT + BTI command 503 0  0 . . . 255Maximum number of responses from an inquiry request. This parameter isreference by the AT+ BTI command 504 0 0 . . . 2 The type of responserequired as a result of issueing an AT + BTI inquiry command. See thedescription of AT + BTI for more details 0 = only Bluetooth address 1 =As 0 plus Device Class 2 = As 1 plus Friendly name 505 5  2 . . . 120Delay before abandoning connection attempt as a master. Referenced bythe ATD. In units of seconds 506 5 065535 Delay before abandoningconnection attempt as a slave. Referenced by the AT + BTP command. Inunits of seconds. 0 means D_NEVER 507 0 0 . . . 1 When set to 0, aconnection can be dropped using {circumflex over ( )}{circumflex over( )}{circumflex over ( )}escape sequence OR the DTR handshaking line 520115200   300 . . . 921600 Baudrate. After changing this value, a powercycle is required to make it active 521 1 1 1 = CTS/RTS hardwarehandshaking enabled 601 n/a TBD Read/Write to Analogue Line 1 602 n/aTBD Read/Write to Analogue Line 2 603 0 0 . . . 1 Set direction ofAnalogue Line 1 604 0 0 . . . 1 Set direction of Analogue Line 2 610 0 0 . . . 255 Set direction of digital i/o lines 611 n/a 0 . . . 1Read/Write to PIO_0 612 n/a 0 . . . 1 Read/Write to PIO_1 613 n/a 0 . .. 1 Read/Write to PIO_2 614 n/a 0 . . . 1 Read/Write to PIO_3 615 n/a 0. . . 1 Read/Write to PIO_4 616 n/a 0 . . . 1 Read/Write to PIO_5 617n/a 0 . . . 1 Read/Write to PIO_6 618 n/a 0 . . . 1 Read/Write to PIO_7619 n/a  0 . . . 255 Read/Write to all 8 Digital lines in one atomicstep

Response: <lf,cr>OK<lf,cr>

If the register is not recognised or the value specified is out of rangethen

Response: <lf,cr>ERROR nn<lf,cr>

3.2.8 ATSn? {Query S Register}

This will return the current value of register n.

For recognised values of n

Response: <If,cr>As Appropriate<lf,cr>OK<lf,cr>

For unrecognised values of n

Response: <If,cr>ERROR nn<lf,cr>

3.2.9 ATD123456789012 {Make Connection}

Make a connection to device with Bluetooth address 123456789012.Authentication and Encryption is as per S registers 500 and 501. Thetimeout is specified by S register 505

Response: <lf,cr>CONNECT<lf,cr>

3.2.10 +++ {Enter Command Mode}

Usually this is the escape sequence for forcing a modem into commandmode when in online state. Since this device could be used to connect toa mobile phone modem over a Bluetooth serial port profile, it couldconfuse matters considerably, therefore the sequence ˆˆˆ used asdescribed next.

3.2.11 ˆˆˆ {Enter Command Mode}

When in online and connected mode, the host can force the device into acommand and connected mode so that AT Commands can be issued to thedevice. The character in this escape sequence is specified in the S2register, so can be changed. In addition, the escape sequence guard timeis specified by S Register 12. By default the guard time is set to 100milliseconds. Please refer to Section 5: Dropping Connections for morerelated information.

Response: <lfcr>OK<lf,cr>{To be decided}

3.2.12 ATA {Answer Call}

Accept an incoming connection. Which is indicated by the unsolicitedstring <lf,cr>RING 123456789012<lf,cr>every second. Where 123456789012is the Bluetooth address of the connecting device.

Response: <lf,cr>CONNECT<lf,cr>

3.2.13 ATH {Drop Connection}

Drop an existing connection or reject an incoming connection indicatedby unsolicited RING messages

Response: <lf,cr>OK<lf,cr>

3.2.14 ATO {Enter Online Mode} (letter ‘o’)

Return to online data mode. Assume online after OK is received. Willrespond with ERROR if there is no Bluetooth connection

Response: <lf,cr>OK<lf,cr>or

Response: <lf,cr>ERROR nn<lf,cr>

3.2.15 AT+BTO {Open and make Unit Detectable}

After power up and ATZ, this command is sent so that RFCOMM isinitialised and opened and the service name as specified in AT+BTN isexposed via the SDP registry.

3.2.16 AT+BTQn {Enable/Disable Inquiry Scans}

If n=0, inquiry scans are disabled, and if n I=0 then inquiry scans areenabled. When inquiry scan is enabled, it implies that this device willrespond to inquiries from other devices.

Response: <lf,cr>OK<lf,cr>

3.2.17 AT+BTK=“012345” {Set Passkey}

Use the pass key 012345 for all subsequent authentication challenges.The value is stored as a string and not a number to ensure leading 0'sare retained.

Response: <lfcr>OK<lf,cr>

3.2.18 AT+BTI {Inquire}

This will make the device perform an inquiry for delay milliseconds andmax number of unique responses, where delay is specified by S register502 and max is specified by S register 503. The type of response isspecified by S register 504. The format of the responses are as follows:

For S504=0, only the Bluetooth addresses are returned.

-   -   Response: <lf,cr>12346789012 <lf,cr>12345678913        <lf,cr>12345678914 <lf,cr>OK<lf,cr>

For S504=1, the Bluetooth addresses and Device class code as 6 characterhexadecimal strings are returned.

-   -   Response: <lf,cr>12346789012,123456 <lf,cr>12345678913,123456        <lf,cr>12345678914,123456 <lf,cr>OK<lf,cr>

For S504=2, as per S504=1 but in addition, the friendly name is returnedbracketed by “. If there are any embedded “ characters in the friendlyname then it is escaped as “”

-   -   Response: <lf,cr>12346789012,123456,“TDK AT DONGLE 1”        <lf,cr>12345678913,123456,“TDK AT DONGLE 2”        <lf,cr>12345678914,123456,“TDK AT DONGLE 3” <lf,cr>OK<lf,cr>        3.2.19 AT+BTX {Disable Page Scanning}

Disable page scanning. This means it will not accept incomingconnections.

Response: <lf,cr>OK<lf,cr>

3.2.20 AT+BTP {Enable Promiscuous Page Scaning}

Enable page scanning and wait for a connection from any device.

Response: <lf,cr>OK<lf,cr>

3.2.21 AT+BTP123456789012 {Enable Cautious Page Scanning}

Enable page scanning and wait for a connection from device withBluetooth address 123456789012. If the specified address is 000000000000then incoming connections are accepted from any device, is as per AT+BTPwithout an address.

Response: <lf,cr>OK<lf,cr>

3.2.22 AT+BTN=“My Friendly Name” {Set Friendly Name}

This sets the friendly name of this device as seen by other devices. Itwill be stored in a non volatile storage area.

Response: <If,cr>OK<lf,cr>

3.2.23 AT+BTR=123456 {Set Device Class Code for inquiries}

This sets the device class code to be used in all subsequent inquirieswhich is triggered by the command AT+BTI.

Response: <lfcr>OK<lf,cr>

3.2.24 AT+BTC=123456 {Set Device Class Code for Inq Responses}

This sets the device class code of this device as seen by other devices.

Response: <lfcr>OK<lf,cr>

3.2.25 AT+BTS=“New Service Name” {Set Service Name}

This sets the Service name as viewed by other Bluetooth devices whenthey perform a service discovery.

Response: <lf,cr>OK<lf,cr>

If the service name cannot be set for any reason then an error responseERROR 11 is returned.

4. Incoming Connections

The device can be configured using the AT+BTP command so that it willscan for incoming connections from other Bluetooth devices. The RFCOMMAPI exposed by CSR is such that incoming calls will be ALWAYS beaccepted, if page scanning is enabled. However, through the AT protocol,a host will always be given the choice whether to accept the call or notvia the ATA and ATH commands respectively.

So when the lower layers indicate that an incoming call has beenaccepted, a RING 123456789012 (every second) string is sent to the host.If ATA is sent by the host then CONNECT is immediately sent and thedevice is put into online mode. If ATH is sent by the host then theconnection is dropped and an OK response is sent back.

5. Dropping Connections

In a conventional telephony modem, a call is normally terminated byfirst sending a +++ character sequence enveloped by an escape sequenceguard time (of the order of 100 to 1000 milliseconds) and then the ATHcommand.

This device will provide two ways of dropping a connection. One methodwill be similar to the above, but instead a ˆˆˆ character sequence willbe used, this is to eliminate ambiguity when a data call is in progressvia a mobile phone which was established using the mobile phone'sBluetooth AT modem. The second method will involve the host dropping theDTR handshaking line.

Being able to drop a connection using the escape sequence ˆˆˆ has asevere penalty on data throughput, in fact, the data rate is of theorder of 40 kbps instead of about 200 kbps. To cater for thisperformance hit, the device's connection drop capability is configurableto be in one of two modes.

Mode 1 allows for a connection to be dropped using either method, andMode 2 allows for a connection drop using the DTR method only. Bydefault, the device is in Mode 1. This mode is selected using the S507register. See S register table described in an earlier section.

6. Error Responses

All error responses from the device will be in the form <lf,cr>ERRORnn<lf,cr>, where nn will be a number in the range 000 to 999. Thereshall be leading 0s if the error value is less than 100.

The error values shall be designated as follows: Error Description 00Command not recognised 01 Register not recognised 02 Value for registeris out of range 03 Incoming call NOT pending 04 No call to connect to.This error code has meaning for ATO only 05 Syntax Error 06 FriendlyName could not be stored: This error code has meaning for AT + BTN only07 Empty String 08 Device Class could not be stored 09 Invalid DeviceClass Code 10 Invalid Bluetooth Address 11 Could not set Service name7. RS232 Signal Pin Mapping

The TDK serial adapter will be a DCE device just like a telephony modemtherefore the GPIO pins brought out to the connecter as detailed insection 1 will be used to provide the control signal functionality.

The mapping will be as follows, where direction is as seen by the deviceand not the host. GPIO Pin Direction Function 0 IN/OUT Unused 1 IN/OUTUnused 2 IN/OUT Unused 3 OUT CI also known as RI 4 IN DTR 5 IN/OUTUnused 6 OUT DCD 7 OUT DSRNotes:GPIO pin 3 (CI), will normally be deasserted. When an incomingconnection is detected it will be asserted, until the connection iseither answered or rejected using ATA and ATH respectively.The state of GPIO pin 4 (DTR) is conveyed to the remote device overRFCOMM, to indicate the ready status of the host to the peerdevice/host.GPIO pin 6 (DCD) will be deasserted when the device is in theunconnected state. Asserted when a connection is active. In additionsince this pin also controls an LED on our device, there is visualindication of a connection.GPIO pin 7 (DSR) will be an indication to the host that this device isavailable. It is also connected to an LED on the device.

With regards to RTS and CTS, they cannot currently (as of Bluelab v2.4)be controlled via the virtual machine. They are controlled/detected bythe low level driver. In addition, as of at Bluelab v2.4 it is notpossible to disable hardware handshaking.

GPIO Pins 0,1,2 and 5 are available for general purpose use.

8. Use Cases

8.1 Example 1: Light Switch Controller

8.1.1 Background

A small microcontroller controlling a single light switch. The serialport is connected to the AT Dongle and a digital output line drives arelay which controls a light. The remote host sends the text “ON” toswitch on the relay and “OFF” to switch it off.

8.1.2 AT Command Sequence AT Command Response Comment ATZ OK Resets thedevice and sets all S Register values to defaults ATN = OK The Servicename will appear as “Light “Light Switch” Switch” AT + BTC = OK Sets theDevice Class code which can hhhhh make the discovery process easier.ATS1 = 1 OK Auto answer incoming connection after 1 ring AT + BTO OKMakes the device detectable and will expose a serial port profile withname “Light Switch” AT + BTP OK Will accept incoming connection from anyCONNECT device Auto answers call At this point the light switch protocoltakes in commands from the remote. For example ON, OFF etc NO CARRIER Ifthe remote end drops the connection OR {circumflex over ( )}{circumflexover ( )}{circumflex over ( )} OK Puts the device in to command mode ATHOK Drops the call.8.2 Example 2: Remote Data Logger8.2.1 Background

A data logger on a remote site gathers data which is then transferred toa central site via a Bluetooth enabled phone. Assume that the remotesite is accessed via the telephone 02089388609 and the PC connected tothe modem logs the data to a file, so all the data logger has to do isopen a connection and then send textual data corresponding to thegathered data.

Assume that the data logger knows the BT address of the phone and assumeit is 123456789012

Further assume that the Bluetooth Phone exposes a serial port profilethrough which an AT modem can be accessed.

8.2.2 AT Command Sequence AT Command Response Comment ATZ OK Resets thedevice and sets all S Register values to defaults AT + BTN = “DataLogger” AT + BTO OK Makes the device detectable and will expose a serialport profile with name “Data Logger” ATD123456789012 CONNECT ATZ OK Thereponse is coming from the Bluetooth phone ATD02089388609 CONNECT Thedata logger sends data which is captured at the remote end. +++ OK Putsthe Bluetooth Phone Modem into command mode ATH OK Drops the call to02089388609 {circumflex over ( )}{circumflex over ( )}{circumflex over( )} OK Puts the device into command mode ATH OK Drops the Bluetoothconnection

1. A Bluetooth serial adapter comprising a Bluetooth connection modulefor conducting Bluetooth communication with another Bluetooth enableddevice, a serial connector allowing connection of a serial cable betweenthe adapter and a device having a serial port, and a serial to Bluetoothinterface arranged for: receiving serial connection control commandsinput via the serial connector; mapping received serial connectioncontrol commands to Bluetooth connection control events; and outputtingthe so determined Bluetooth connection control events to the Bluetoothconnection module.
 2. A Bluetooth serial adapter according to claim 1 inwhich the serial to Bluetooth interface arranged for: receivingBluetooth connection control events from the Bluetooth connectionmodule; mapping received Bluetooth connection control events to serialconnection control commands; and outputting the so determined serialconnection control commands to the serial connector for onwardtransmission to a device having a serial port.
 3. A Bluetooth serialadapter according to claim 1 in which the set of serial connectioncontrol commands is smaller than the array of events provided inBluetooth.
 4. A Bluetooth serial adapter according to claim 3 in whicheach serial connection control command is mapped to a correspondingBluetooth event but there is at least one Bluetooth event that has nocorresponding serial connection control command.
 5. A Bluetooth serialadapter according to claim 1 in which the serial connection controlcommands comprise a command set having commands which are one of:analogous to, directly related to, and substantially identical to,commands used in an industry standard command set used in controllingModem connections.
 6. A Bluetooth serial adapter according to claim 1 inwhich the serial connection control commands comprise a set of ATcommands.
 7. A Bluetooth serial adapter according to claim 1 in whichthe serial connection control commands comprise one of: the set ofcommands, or a subset of the commands, mentioned and explained insection 3.2 of Annex 1 to the description of this application.
 8. ABluetooth serial adapter according to claim 1 in which the Bluetoothconnection module comprises a Bluetooth chip carrying a programmablevirtual machine programmed to act as the serial to Bluetooth interface.9. A Bluetooth serial adapter comprising a Bluetooth connection modulefor conducting Bluetooth communication with another Bluetooth enableddevice, a serial connector allowing connection of a serial cable betweenthe adapter and a device having a serial port, and a serial to Bluetoothinterface arranged for: receiving Bluetooth connection control eventsfrom the Bluetooth connection module; mapping received Bluetoothconnection control events to serial connection control commands; andoutputting the so determined serial connection control commands to theserial connector for onward transmission to a device having a serialport.
 10. A method of communicating via a Bluetooth connection using adevice with a serial port, comprising the step of using a Bluetoothserial adapter comprising a Bluetooth connection module for conductingBluetooth communication with another Bluetooth enabled device, a serialconnector connected via a serial cable to the device having a serialport, and a serial to Bluetooth interface, the method further comprisingthe serial to Bluetooth interface carrying out the steps of: receivingserial connection control commands from the device via the serial cable;mapping received serial connection control commands to Bluetoothconnection control events; and outputting the so determined Bluetoothconnection control events to the Bluetooth connection module.
 11. Amethod of communicating via a Bluetooth connection using a device with aserial port, comprising the step of using a Bluetooth serial adaptercomprising a Bluetooth connection module for conducting Bluetoothcommunication with another Bluetooth enabled device, a serial connectorconnected via a serial cable to the device having a serial port, and aserial to Bluetooth interface, the method further comprising the serialto Bluetooth interface carrying out the steps of: receiving Bluetoothconnection control events from the Bluetooth connection module; mappingreceived Bluetooth connection control events to serial connectioncontrol commands; and outputting the so determined serial connectioncontrol commands via the serial cable to the device having a serialport.
 12. A virtual serial connection system between two devices each ofwhich has a serial port, the system comprising a pair of Bluetoothserial adapters according to claim 1, one of the adapters beingconnected to a first of the devices via a first serial cable and theother of the adapters being connected to the second of the devices via asecond serial cable, wherein the virtual serial connection is completedby Bluetooth communication between the two Bluetooth serial adapters.13. A computer program comprising code portions which when loaded andrun on computer cause the computer to carry out a method according toclaim 10 and/or to function as a serial to Bluetooth interface.
 14. Acomputer readable data carrier such as a signal or a record medium forexample RAM, ROM, EEPROM, a floppy disk, a hard disk, or a CD-ROMcarrying a computer program according to claim 13.